package com.samp.base.file.diff;

import java.io.BufferedReader;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;

/**
 *找出两个文件中不同的行。 
 *
 *
 */
public class FindDiffLines {
	
	private static List<String> getLinesFromFile(String file){
		List<String> list = new ArrayList<String>();
		try {
			BufferedReader bf = Files.newBufferedReader(Paths.get(file));
			String line = bf.readLine();
			while( line != null ){
				list.add(line.trim());
				line = bf.readLine();
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
		return list;
	}
	
	public static void main(String[] args) {
		String  path01 = "D:\\temp\\compare\\1.txt";
		String  path02 = "D:\\temp\\compare\\2.txt";
		List<String> list01 = getLinesFromFile(path01);
		List<String> list02 = getLinesFromFile(path02);
		list02.removeAll(list01);
		System.out.println(list02);
	}

}
